3.1.13 \(\int (a+a \sec (c+d x)) \tan ^2(c+d x) \, dx\) [13]

Optimal. Leaf size=45 \[ -a x-\frac {a \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {(2 a+a \sec (c+d x)) \tan (c+d x)}{2 d} \]

[Out]

-a*x-1/2*a*arctanh(sin(d*x+c))/d+1/2*(2*a+a*sec(d*x+c))*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 45, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3966, 3855} \begin {gather*} -\frac {a \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {\tan (c+d x) (a \sec (c+d x)+2 a)}{2 d}-a x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + a*Sec[c + d*x])*Tan[c + d*x]^2,x]

[Out]

-(a*x) - (a*ArcTanh[Sin[c + d*x]])/(2*d) + ((2*a + a*Sec[c + d*x])*Tan[c + d*x])/(2*d)

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3966

Int[(cot[(c_.) + (d_.)*(x_)]*(e_.))^(m_)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(-e)*(e*Cot
[c + d*x])^(m - 1)*((a*m + b*(m - 1)*Csc[c + d*x])/(d*m*(m - 1))), x] - Dist[e^2/m, Int[(e*Cot[c + d*x])^(m -
2)*(a*m + b*(m - 1)*Csc[c + d*x]), x], x] /; FreeQ[{a, b, c, d, e}, x] && GtQ[m, 1]

Rubi steps

\begin {align*} \int (a+a \sec (c+d x)) \tan ^2(c+d x) \, dx &=\frac {(2 a+a \sec (c+d x)) \tan (c+d x)}{2 d}-\frac {1}{2} \int (2 a+a \sec (c+d x)) \, dx\\ &=-a x+\frac {(2 a+a \sec (c+d x)) \tan (c+d x)}{2 d}-\frac {1}{2} a \int \sec (c+d x) \, dx\\ &=-a x-\frac {a \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {(2 a+a \sec (c+d x)) \tan (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 60, normalized size = 1.33 \begin {gather*} -\frac {a \text {ArcTan}(\tan (c+d x))}{d}-\frac {a \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a \tan (c+d x)}{d}+\frac {a \sec (c+d x) \tan (c+d x)}{2 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Sec[c + d*x])*Tan[c + d*x]^2,x]

[Out]

-((a*ArcTan[Tan[c + d*x]])/d) - (a*ArcTanh[Sin[c + d*x]])/(2*d) + (a*Tan[c + d*x])/d + (a*Sec[c + d*x]*Tan[c +
 d*x])/(2*d)

________________________________________________________________________________________

Maple [A]
time = 0.07, size = 67, normalized size = 1.49

method result size
derivativedivides \(\frac {a \left (\frac {\sin ^{3}\left (d x +c \right )}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+a \left (\tan \left (d x +c \right )-d x -c \right )}{d}\) \(67\)
default \(\frac {a \left (\frac {\sin ^{3}\left (d x +c \right )}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+a \left (\tan \left (d x +c \right )-d x -c \right )}{d}\) \(67\)
risch \(-a x -\frac {i a \left ({\mathrm e}^{3 i \left (d x +c \right )}-2 \,{\mathrm e}^{2 i \left (d x +c \right )}-{\mathrm e}^{i \left (d x +c \right )}-2\right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{2 d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{2 d}\) \(97\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+a*sec(d*x+c))*tan(d*x+c)^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(a*(1/2*sin(d*x+c)^3/cos(d*x+c)^2+1/2*sin(d*x+c)-1/2*ln(sec(d*x+c)+tan(d*x+c)))+a*(tan(d*x+c)-d*x-c))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 65, normalized size = 1.44 \begin {gather*} -\frac {4 \, {\left (d x + c - \tan \left (d x + c\right )\right )} a + a {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} + \log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )}}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(d*x+c))*tan(d*x+c)^2,x, algorithm="maxima")

[Out]

-1/4*(4*(d*x + c - tan(d*x + c))*a + a*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) + log(sin(d*x + c) + 1) - log(sin(
d*x + c) - 1)))/d

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 87 vs. \(2 (41) = 82\).
time = 2.65, size = 87, normalized size = 1.93 \begin {gather*} -\frac {4 \, a d x \cos \left (d x + c\right )^{2} + a \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - a \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, a \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(d*x+c))*tan(d*x+c)^2,x, algorithm="fricas")

[Out]

-1/4*(4*a*d*x*cos(d*x + c)^2 + a*cos(d*x + c)^2*log(sin(d*x + c) + 1) - a*cos(d*x + c)^2*log(-sin(d*x + c) + 1
) - 2*(2*a*cos(d*x + c) + a)*sin(d*x + c))/(d*cos(d*x + c)^2)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a \left (\int \tan ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int \tan ^{2}{\left (c + d x \right )}\, dx\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(d*x+c))*tan(d*x+c)**2,x)

[Out]

a*(Integral(tan(c + d*x)**2*sec(c + d*x), x) + Integral(tan(c + d*x)**2, x))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 88 vs. \(2 (41) = 82\).
time = 0.62, size = 88, normalized size = 1.96 \begin {gather*} -\frac {2 \, {\left (d x + c\right )} a + a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(d*x+c))*tan(d*x+c)^2,x, algorithm="giac")

[Out]

-1/2*(2*(d*x + c)*a + a*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - a*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + 2*(a*tan(1
/2*d*x + 1/2*c)^3 - 3*a*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 - 1)^2)/d

________________________________________________________________________________________

Mupad [B]
time = 1.14, size = 80, normalized size = 1.78 \begin {gather*} \frac {3\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}-a\,x-\frac {a\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(c + d*x)^2*(a + a/cos(c + d*x)),x)

[Out]

(3*a*tan(c/2 + (d*x)/2) - a*tan(c/2 + (d*x)/2)^3)/(d*(tan(c/2 + (d*x)/2)^4 - 2*tan(c/2 + (d*x)/2)^2 + 1)) - a*
x - (a*atanh(tan(c/2 + (d*x)/2)))/d

________________________________________________________________________________________